<template>
  <el-form ref="formobj" :model="wyform" :rules="rules" label-width="100px">
		<el-form-item label="姓名" prop="name">
			<el-input v-model="wyform.name" placeholder="请输入学生姓名"></el-input>
		</el-form-item>
		<el-form-item label="手机号" prop="phone">
			<el-input v-model="wyform.phone" placeholder="请输入手机号"></el-input>
		</el-form-item>
		<el-form-item label="电子信箱" prop="email">
			<el-input v-model="wyform.email" placeholder="请输入电子信箱"></el-input>
		</el-form-item>
		<el-form-item label="生日" prop="birthday">
			<el-date-picker
				v-model="wyform.birthday"
				type="date"
				value-format="YYYY-MM-DD"
				placeholder="请选择生日"></el-date-picker>
		</el-form-item>
		<el-form-item label="毕业院校" prop="school">
			<el-select-v2
				v-model="wyform.school"
				filterable
				placeholder="请选择毕业院校"
				:options="school_list"
			></el-select-v2>
		</el-form-item>
		<el-form-item label="专业" prop="major">
			<el-select filterable v-model="wyform.major" placeholder="请选择专业">
				<el-option
					v-for="(item, index) in majors"
					:key="index"
					:label="item"
					:value="item"></el-option>
			</el-select>

		</el-form-item>
		<el-form-item label="学历" prop="qualification">
			<el-select v-model="wyform.qualification" placeholder="请选择学历">
				<el-option label="大专" value="大专"></el-option>
				<el-option label="本科" value="本科"></el-option>
				<el-option label="硕士" value="硕士"></el-option>
				<el-option label="博士" value="博士"></el-option>
			</el-select>
		</el-form-item>
		<el-form-item>
			<el-button type="primary" @click="save">保存</el-button>
		</el-form-item>
	</el-form>
</template>

<script setup>
import { ref, reactive } from 'vue'
import { majors, schools } from '@/static/data'
const formobj = ref()
const props = defineProps(['formVal', 'rules'])
const emits = defineEmits(['save'])
const wyform = props.formVal
const rules = props.rules
const school_list = reactive([])
for (const i in schools) {
	school_list.push({
		label: schools[i].address + '----' + schools[i].name,
		value: schools[i].name
	})
}


function save () {
	formobj.value.validate(valid => {
		if (valid) {
			emits('save')
		}
	})
}
</script>

<style scoped lang="scss">
.el-form-item {
	::v-deep .el-input, ::v-deep .el-select {
		width: 300px;
	}
}

</style>